package com.fs.chatx.module.common.service;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;

@Component
public class PromptLoader {

    @Value("classpath:prompts/inspection_prompt.yaml")
    private Resource inspectionPromptResource;

    public String loadInspectionPrompt() throws IOException
    {
        return new String(inspectionPromptResource.getInputStream().readAllBytes(), StandardCharsets.UTF_8);

    }

    public String extractionPrompt() throws IOException
    {
        String extractionPrompt = new String(Files.readAllBytes(Paths.get("prompts/ocr_extraction_prompt.yaml")));
        return extractionPrompt;
    }

}
